<?php


namespace app\agent\controller\coupon;

use app\model\CouponProduct;
use think\Request;
use app\model\CouponProductChannel;
use app\agent\controller\Controller;

class ProductChannel extends Controller
{
    protected function initialize()
    {
        parent::initialize();
    }

    /**
     * 会员卡券商品管理——直充商品列表
     * @access public
     * @method get
     * @return \think\response\Json
     */
    public function getList(Request $request)
    {
        $params = $request->param();
        //展示已匹配的商品
        $params['relate_state'] = CouponProductChannel::RELETE_STATE_YPP;
        $params['shelf_state'] = CouponProductChannel::SHELF_STATE_SZ;
        $params['agent_id'] = $this->agent->id;
        //代理端
        $params['is_agent'] = 1;
        $list = (new CouponProductChannel())->getList($params);
        //暂不启用新的查询方式 add by ymzhang 2022-10-21 16:20
        //$list = (new CouponProduct())->getList($params);
        return success('请求成功', $list);
    }

    /**
     * 会员卡券商品管理——获取各个下拉框
     * @access public
     * @method get
     * @return \think\response\Json
     */
    public function getStatus()
    {
        return success('请求成功', (new CouponProductChannel())->getStatus());
    }
}